home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr37 / aussiebb.zip / CAPI.ZIP / JAMMB.H < prev    next >
C/C++ Source or Header  |  1993-07-01  |  7KB  |  167 lines

  1. /*
  2. **  JAM(mbp) - The Joaquim-Andrew-Mats Message Base Proposal
  3. **
  4. **  C API
  5. **
  6. **  Written by Joaquim Homrighausen.
  7. **
  8. **  ----------------------------------------------------------------------
  9. **
  10. **  jammb.h (JAMmb)
  11. **
  12. **  Prototypes and definitions for the JAM message base API
  13. **
  14. **  Copyright 1993 Joaquim Homrighausen, Andrew Milner, Mats Birch, and
  15. **  Mats Wallin. ALL RIGHTS RESERVED.
  16. **
  17. **  93-06-28    JoHo
  18. **  Initial coding.
  19. */
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. #ifndef __JAMMB_H__
  25. #define __JAMMB_H__
  26.  
  27. #ifndef __JAM_H__
  28. #include "jam.h"
  29. #endif
  30.  
  31. #define JAMAPIMSG_NOTHING       0
  32. #define JAMAPIMSG_HDRPRINT      1  /* Header fingerprint missing or invalid */
  33. #define JAMAPIMSG_HDRPASSWORD   2  /* Invalid password for header file */
  34. #define JAMAPIMSG_MSGPASSWORD   3  /* Invalid password for message */
  35. #define JAMAPIMSG_ISOPEN        4  /* Message base is open */
  36. #define JAMAPIMSG_ISNOTOPEN     5  /* Message base is not open */
  37. #define JAMAPIMSG_ISNOTLOCKED   6  /* Message base is not locked */
  38. #define JAMAPIMSG_SEEKERROR     7  /* Unable to seek in file */
  39. #define JAMAPIMSG_CANTMKFILE    8  /* Unable to create file */
  40. #define JAMAPIMSG_CANTRDFILE    9  /* Unable to read file */
  41. #define JAMAPIMSG_CANTWRFILE    10 /* Unable to write file */
  42. #define JAMAPIMSG_CANTRMFILE    11 /* Unable to remove file */
  43. #define JAMAPIMSG_FIRSTMSG      12 /* Already on first message */
  44. #define JAMAPIMSG_NEWMODCOUNTER 13 /* ModCounter have been updated since read */
  45. #define JAMAPIMSG_NOMORETEXT    14 /* Read to end of message text */
  46. #define JAMAPIMSG_CANTLKFILE    15 /* Unable to lock message base */
  47. #define JAMAPIMSG_CANTFINDUSER  16 /* Unable to locate LastRead record */
  48. #define JAMAPIMSG_CANTFINDMSG   17 /* Unable to locate message to user */
  49. #define JAMAPIMSG_NOMOREMSGS    18 /* At end or beginning of file */
  50. #define JAMAPIMSG_BADHEADERSIG  19 /* Invalid message header signature */
  51. #define JAMAPIMSG_BADHEADERREV  20 /* Invalid message header revision */
  52. #define JAMAPIMSG_INVMSGNUM     21 /* Invalid message number specified */
  53.  
  54. /*
  55. **  Values for "fromwhere" parameter to SeekFunc, identical to those normally
  56. **  defined in IO.H as SEEK_SET, SEEK_CUR, and SEEK_END.
  57. */
  58. #define JAMSEEK_SET             0  /* To specified position */
  59. #define JAMSEEK_CUR             1  /* From current position */
  60. #define JAMSEEK_END             2  /* From end of file */
  61.  
  62. /*
  63. **  Return values for user comparison functions
  64. */
  65. #define ScanMsgHdrStop          0
  66. #define ScanMsgHdrDiscard       1
  67. #define ScanMsgHdrNextHdr       2
  68.  
  69. #define ScanMsgIdxStop          0
  70. #define ScanMsgIdxNextMsg       1
  71.  
  72. /*
  73. **  Basic structure definition. Most functions in the API require that
  74. **  JAMAPIRECptr is passed to them.
  75. */
  76. typedef struct _JAMAPIREC
  77.     {
  78.     CHAR8           BaseName[200];  /* Path for message base */
  79.     CHAR8ptr        WorkBuf;        /* Workspace (initialized by user) */
  80.     UINT32          WorkLen;        /* Length of workspace (see above) */
  81.     UINT32          WorkPos;        /* Current position, for multi-reads */
  82.     INT16           isOpen;         /* Is open */
  83.     INT16           HaveLock;       /* .JHR file is locked */
  84.     int             Errno;          /* Last value of errno in case of error */
  85.     int             APImsg;         /* API informative message */
  86.     FHANDLE         HdrHandle;      /* File handle for .JHR file */
  87.     FHANDLE         TxtHandle;      /* File handle for .JDT file */
  88.     FHANDLE         IdxHandle;      /* File handle for .JDX file */
  89.     FHANDLE         LrdHandle;      /* File handle for .JLR file */
  90.     UINT32          LastMsgNum;     /* Last message number fetched */
  91.     JAMIDXREC       Idx;            /* Message index */
  92.     JAMHDR          Hdr;            /* Message header */
  93.     JAMHDRINFO      HdrInfo;        /* Message header info */
  94.     JAMSUBFIELDptr  SubFieldPtr;    /* Pointer to Subfield structure */
  95.     UINT32          LastLRDnum;     /* Last LastRead record fetched (0-based) */
  96.     JAMLREAD        LastRead;       /* LastRead (workspace) */
  97.  
  98.     /* Functions */
  99.  
  100.     FHANDLE (_JAMPROC * CreateFunc)(struct _JAMAPIREC _JAMDATA *, CHAR8ptr FileName);
  101.     FHANDLE (_JAMPROC * OpenFunc)(struct _JAMAPIREC _JAMDATA *, CHAR8ptr FileName);
  102.     int (_JAMPROC * CloseFunc)(struct _JAMAPIREC _JAMDATA *, FHANDLE Handle);
  103.     INT32 (_JAMPROC * ReadFunc)(struct _JAMAPIREC _JAMDATA *, FHANDLE Handle, VOIDptr Buffer, INT32 Length);
  104.     INT32 (_JAMPROC * WriteFunc)(struct _JAMAPIREC _JAMDATA *, FHANDLE Handle, VOIDptr Buffer, INT32 Length);
  105.     INT32 (_JAMPROC * SeekFunc)(struct _JAMAPIREC _JAMDATA *, FHANDLE Handle, int FromWhere, INT32 Offset);
  106.     int (_JAMPROC * LockFunc)(struct _JAMAPIREC _JAMDATA *, int DoLock);
  107.     int (_JAMPROC * UnlinkFunc)(struct _JAMAPIREC _JAMDATA *, CHAR8ptr FileName);
  108.     }
  109.     JAMAPIREC, _JAMDATA * JAMAPIRECptr;
  110.  
  111. /*
  112. **  User comparison functions
  113. */
  114. typedef int (_JAMPROC * ScanMsgHdrComp)(JAMAPIRECptr);
  115. typedef int (_JAMPROC * ScanMsgIdxComp)(JAMAPIRECptr);
  116.  
  117. /*
  118. **  API function prototypes
  119. */
  120. int _JAMPROC JAMmbOpen(JAMAPIRECptr apirec);
  121. int _JAMPROC JAMmbCreate(JAMAPIRECptr apirec);
  122. int _JAMPROC JAMmbClose(JAMAPIRECptr apirec);
  123. int _JAMPROC JAMmbUnlink(JAMAPIRECptr apirec);
  124. int _JAMPROC JAMmbReIndex(JAMAPIRECptr apirec);
  125.  
  126. int _JAMPROC JAMmbUpdateHeaderInfo(JAMAPIRECptr apirec, int);
  127.  
  128. int _JAMPROC JAMmbFindField(JAMAPIRECptr apirec, UINT32, UINT32ptr);
  129. int _JAMPROC JAMmbAddField(JAMAPIRECptr apirec, UINT32, int, 
  130.                                 unsigned int, UINT32ptr, CHAR8ptr);
  131.  
  132. int _JAMPROC JAMmbFetchMsgHdr(JAMAPIRECptr apirec, UINT32, int);
  133. int _JAMPROC JAMmbFetchMsgIdx(JAMAPIRECptr apirec, UINT32);
  134. int _JAMPROC JAMmbFetchNextMsgHdr(JAMAPIRECptr apirec, int);
  135. int _JAMPROC JAMmbFetchPrevMsgHdr(JAMAPIRECptr apirec, int);
  136. int _JAMPROC JAMmbFetchMsgTxt(JAMAPIRECptr apirec, int);
  137.  
  138. int _JAMPROC JAMmbScanForMsgHdr(JAMAPIRECptr apirec, UINT32 WhatMsg,
  139.                                 int ScanFwd,
  140.                                 ScanMsgHdrComp UserCompare);
  141. int _JAMPROC JAMmbScanForMsgIdx(JAMAPIRECptr apirec, UINT32 WhatMsg,
  142.                                 int ScanFwd,
  143.                                 ScanMsgIdxComp UserCompare);
  144.  
  145. int _JAMPROC JAMmbStoreMsgHdr(JAMAPIRECptr apirec, UINT32);
  146. int _JAMPROC JAMmbStoreMsgIdx(JAMAPIRECptr apirec, UINT32);
  147. int _JAMPROC JAMmbStoreMsgTxt(JAMAPIRECptr apirec);
  148. int _JAMPROC JAMmbStoreMsgTxtBuf(JAMAPIRECptr apirec, CHAR8ptr, INT32, int);
  149.  
  150. int _JAMPROC JAMmbLockMsgBase(JAMAPIRECptr apirec, int);
  151. int _JAMPROC JAMmbUnLockMsgBase(JAMAPIRECptr apirec, int);
  152.  
  153. int _JAMPROC JAMmbFetchLastRead(JAMAPIRECptr apirec, UINT32);
  154. int _JAMPROC JAMmbStoreLastRead(JAMAPIRECptr apirec, int);
  155.  
  156. #ifndef __JAMPROT_H__
  157. #include "jamprot.h"
  158. #endif
  159.  
  160. #endif /* __JAMMB_H__ */
  161.  
  162. #ifdef __cplusplus
  163. }
  164. #endif
  165.  
  166. /* end of file "jammb.h" */
  167.